<template>
	<view>
		<!-- 登录前 -->
		<view class="header" v-if="dengluqian">
			<image @click="gobackLogin" class="photo" src="../../static/user/photo.png"></image>
			<text class="login" @click="gologin">登录/注册</text>
			<image class="xiaoxi" src="../../static/user/xiaoxi.png"></image>
			<view class="walletBox">
				<image class="qbimg" src="../../static/user/yue.png"></image>
				<text class="qbfont" @click="gotixian()">我的钱包</text>
				<text class="dashed">--</text>
				<view @click="gonexttx" class="txian">提现</view>
				<view class="vouchersBox">
					<view class="record">
						<text class="dasheda">--</text>
						<text class="gongxian">今日贡献值</text>
					</view>
					<view class="record">
						<text class="dasheda">--</text>
						<text class="gongxian">本月贡献值</text>
					</view>
					<view class="record">
						<text class="dasheda">--</text>
						<text class="gongxian">累计贡献值</text>
					</view>
					<view class="record">
						<text class="dasheda">--</text>
						<text class="gongxian">现金卷</text>
					</view>
				</view>
			</view>
		</view>
		<!-- 登陆后 -->
		<view v-if="dengluhou" class="header">
			<view class="peopleInfo">
				<image @click="gopersonInfo" class="photoa" :src="user_info.member_avatar"></image>
				<image class="viplogo" :src="viplogo"></image>
				<view class="nameBox">
					<text class="name">{{user_info.member_name}}</text>
					<view class="vipBox">
						<image class="vip" src="/static/user/vip.png"></image>
						<text class="huangguan">皇冠会员</text>
					</view>
				</view>
				<text class="invitationCode">邀请码: {{user_info.inviter_num}}</text>
				<text class="address" v-if="user_info.address!=''">地址: {{user_info.address}}</text>
				<text class="address" v-else>地址:- - - - </text>
			</view>
			<image class="xiaoxi" src="../../static/user/xiaoxi.png"></image>
			<view class="walletBox">
				<image class="qbimg" src="../../static/user/yue.png"></image>
				<text class="qbfont" @click="gotixian()">我的钱包</text>
				<text class="dashed">{{user_info.curreny}}</text>
				<view class="txian" @click="gonexttx">提现</view>
				<view class="vouchersBox">
					<view class="record">
						<text class="dasheda">{{user_info.member_contribution}}</text>
						<text class="gongxian">今日贡献值</text>
					</view>
					<view class="record">
						<text class="dasheda">{{user_info.task_currency}}</text>
						<text class="gongxian">任务凭证数</text>
					</view>
					<view class="record">
						<text class="dasheda">{{user_info.commission_currency}}</text>
						<text class="gongxian">佣金凭证数</text>
					</view>
					<view class="record">
						<text class="dasheda">{{user_info.total_currency}}</text>
						<text class="gongxian">现金卷</text>
					</view>
				</view>
			</view>
		</view>
		<view class="orderBox">
			<text class="frame"></text>
			<text class="myOrder">我的订单</text>
			<view class="allorder">
				<text  class="online" >{{lineor==true?onLine:unLine}}</text>
				<image @click="switchbutton" class="switch" src="../../static/user/qiehuan.png"></image>
				<text  class="unline" @click="switchbutton">{{lineor==true?unLine:onLine}}</text>
				<!-- 线上订单 -->
				<view v-show="!fold" class="statuebox">
					<view class="paystatue" v-for="(item,index) in onLineData" :key="index" >
						<image class="statueimg" :src="item.onlineimg" @click="goxiangshang(item)"></image>
						<text class="statueFont">{{item.onlinefont}}</text>
					</view>
				</view>
				<!-- 线下订单 -->
				<view v-show="fold" class="statuebox">
					<view class="paystatue" v-for="(item,index) in unLineData" :key="index" >
						<image class="statueimg" :src="item.onlineimg" @click="goxiangxia(item)"></image>
						<text class="statueFont">{{item.onlinefont}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="fotter">
			<text class="bksolid"></text>
			<text class="administration">管理专区</text>
			<view class="infoBox">
				<navigator url="order_receiving_management/order_receiving_management" class="adminSon">
					<image class="infoImg" src="../../static/user2/jiedan.png"></image>
					<text class="infoFont">接单管理</text>
				</navigator>
				<navigator url="./releaseManagement/releaseManagement" class="adminSon">
					<image class="infoImg" src="../../static/user2/fangdan.png"></image>
					<text class="infoFont">放单管理</text>
				</navigator>
				<view @click="goteam" class="adminSon">
					<image class="infoImg" src="../../static/user2/team.png"></image>
					<text class="infoFont">我的团队</text>
				</view>
				<view @click="goproblem" class="adminSon">
					<image class="infoImg" src="../../static/user2/wenti.png"></image>
					<text class="infoFont">常见问题</text>
				</view>
				<view class="adminSon" @click="gofeedback">
					<image class="infoImg" src="../../static/user2/fankui.png"></image>
					<text class="infoFont">用户反馈</text>
				</view>
				<view @click="goaboutme" class="adminSon">
					<image class="infoImg" src="../../static/user2/aboutme.png"></image>
					<text class="infoFont">关于我们</text>
				</view>
				<view @click="goinvation" class="adminSon">
					<image class="infoImg" src="../../static/user2/invationIcon.png"></image>
					<text class="infoFont">邀请好友</text>
				</view>
				<view @click="gobind" class="adminSon">
					<image class="infoImg" src="../../static/user2/bangding.png"></image>
					<text class="infoFont">绑定账号</text>
				</view>
				<view @click="goBusiness" class="adminSon" v-if="userInfo!=''">
					<image class="infoImg" src="../../static/user2/ruzhu.png"></image>
					<text class="infoFont">
					{{user_info.is_merchant}}
					</text>
				</view>
				<view class="adminSon" @click="close_token()">
					<text class="infoFont">退出登录</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Require from '../../common/require.js';
	export default {
		data() {
			return {
				user_info: '',
				dengluqian: true,
				dengluhou: false,
				fold: false,
				lineor: true,
				myWallet: '3.1415926',
				todayValue: '1.4465',
				monthValue: '2.22455',
				vouchers: '525',
				photo: '../../static/user/photo.png',
				viplogo: '../../static/user/viplogo.png',
				name: '鱼书',
				invitationCode: '123456',
				address: '安徽省合肥市高新区产业园',
				onLine: '线上订单',
				unLine: '线下订单',
				onLineData: [
					{
						onlineimg: '../../static/user/quanbu.png',
						onlinefont: '全部订单',
						index:0
					},
					{
						onlineimg: '../../static/user/pay.png',
						onlinefont: '未支付',
						index:1
					},
					{
						onlineimg: '../../static/user/fahuo.png',
						onlinefont: '未发货',
						index:2
					},
					{
						onlineimg: '../../static/user/shouhuo.png',
						onlinefont: '未收货',
						index:3
					},
					{
						onlineimg: '../../static/user/shouhou.png',
						onlinefont: '退款/售后',
						index:4
					},
					
				],
				unLineData: [
					{
						onlineimg: '../../static/user/quanbu.png',
						onlinefont: '全部订单',
						index:0
					},
					{
						onlineimg: '../../static/user/pay.png',
						onlinefont: '未支付',
						index:1
					},
					
					{
						onlineimg: '../../static/user/pinjia.png',
						onlinefont: '未评价',
						index:2
					},
					{
						onlineimg: '../../static/user/shouhou.png',
						onlinefont: '退款/售后',
						index:3
					},
				],
				userInfo: ''
			}
		},
		onShow() {
			var self = this
			self.userInfo = uni.getStorageSync('loginInfo');
			self.getLogin()
			self.kaishi()
		},
		onLoad() {},
		filters: {
		  numFilter (value) {
		    let realVal = parseFloat(value).toFixed(2)
		    return realVal
		  }
		},
		methods: {
			goxiangshang(item){
				var self=this
				if(self.userInfo!=''){
					uni.navigateTo({
						url: "Online_and_offline/Online_and_offline_xia?index="+item.index
					})
				}else{ 
					uni.showToast({
						icon: "none",
						title: "您还未登录，请登录后查看！"
					})
				}
			},
			goxiangxia(item){
				var self=this
				if(self.userInfo!=''){
					uni.navigateTo({
						url: "Online_and_offline/Online_and_offline?index="+item.index
					})
				}else{ 
					uni.showToast({
						icon: "none",
						title: "您还未登录，请登录后查看！"
					})
				}
			},
			gobackLogin() {
				uni.navigateTo({
					url: '/pages/login/login'
				})
			},
			gopersonInfo() {
				uni.navigateTo({
					url: './personalInformation'
				})
			},
			gofeedback(){
				var self=this
				if(self.userInfo!=''){
					uni.navigateTo({
						url:"./feedback"
					})
				}else{ 
					uni.showToast({
						icon: "none",
						title: "您还未登录，请登录后查看！"
					})
				}
			},
			gotixian(){
				var self=this
				if(self.userInfo!=''){
					uni.navigateTo({
						url:"./tixian/detailed"
					})
				}else{ 
					uni.showToast({
						icon: "none",
						title: "您还未登录，请登录后查看！"
					})
				}
			},
			kaishi() {
				var self = this
				if (self.userInfo == '') {
					self.dengluqian = true
					self.dengluhou = false
				} else {
					self.dengluqian = false
					self.dengluhou = true
				}
			},
			close_token() {
				uni.removeStorage({
					key: 'loginInfo',
					success(e) {
						console.log(e)
						uni.switchTab({
							url: "../index/index"
						})
					}
				})
			},
			getLogin() {
				var self = this
				Require.commonRequest({
					url: '/api/member/account',
					success: function(ret) {
						if (ret.data.code == 200)
							self.user_info = ret.data.data
							console.log(ret.data.data)
					},
					fail: function() {
						uni.showToast({
							icon: "none",
							title: "网络异常，请稍后再试"
						})
					}
				})
			},
			switchbutton() {
				this.lineor = !this.lineor;
				this.fold = !this.fold
				console.log(this.fold)
			},
			gonexttx() {
				var self = this
				if (self.userInfo != '') {
					uni.navigateTo({
						url: './tixian/tixian'
					})
				} else {
					uni.showToast({
						icon: 'none',
						title: '您的账号未登录'
					})
				}
			},
			gobind() {
				uni.navigateTo({
					url: './bindAccount/bindAccount'
				})
			},
			goaboutme() {
				uni.navigateTo({
					url: './aboutme'
				})
			},
			goproblem() {
				uni.navigateTo({
					url: './comProblem'
				})
			},
			
			goBusiness() {
				var self=this
				if(self.user_info.is_merchant=='商家入驻'){
					uni.navigateTo({
						url: './merchantSettled/userCenter'
					})
				}else if(self.user_info.is_merchant=='商家管理'){
					self.shenghedianpu()
				}
				
			},
			// 判断店铺审核状态
			shenghedianpu() {
				var self = this
				Require.commonRequest({
					url: '/api/store/state',
					success: function(ret) {
						console.log(ret.data.data.state)
						if (ret.data.code == 200)
						if(ret.data.data.state==10){
							uni.navigateTo({
								url:"merchantSettled/auditStatus?id="+3
							})
							
						}else if(ret.data.data.state==20){
								uni.navigateTo({
									url:"merchantSettled/merchantIndex"
								})
						}else if(ret.data.data.state==30){
							uni.navigateTo({
								url:"merchantSettled/auditStatus?id="+2
							})
						}
					},
					fail: function() {
						uni.showToast({
							icon: "none",
							title: "网络异常，请稍后再试"
						})
					}
				})
			},
			goteam() {
				var self = this
				if (self.userInfo != '') {
					uni.navigateTo({
						url: './myTeam/myTeam'
					})
				} else {
					uni.showToast({
						icon: 'none',
						title: '您的账号未登录'
					})
				}

			},
			gologin() {
				uni.navigateTo({
					url: "../login/login"
				})
			},
			goinvation() {
				var self = this
				if (self.userInfo != '') {
				uni.navigateTo({
					url: './inviteFriends/inviteFriends'
				})
				} else {
					uni.showToast({
						icon: 'none',
						title: '您的账号未登录'
					})
				}
			}
		}
	}
</script>

<style>
	.header {
		width: 750rpx;
		height: 400rpx;
		background: url(../../static/user/bg.png) no-repeat;
		background-size: cover;
		/* margin-top: var(--status-bar-height); */
		position: relative;
	}

	.photo {
		width: 121rpx;
		height: 121rpx;
		position: absolute;
		bottom: 170rpx;
		left: 35rpx;
	}

	.login {
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(255, 255, 255, 1);
		position: absolute;
		bottom: 215rpx;
		left: 187rpx;
	}

	.xiaoxi {
		width: 28rpx;
		height: 30rpx;
		position: absolute;
		top: 70rpx;
		right: 45rpx;
	}

	.walletBox {
		width: 680rpx;
		height: 220rpx;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(115, 34, 216, 0.2);
		border-radius: 20rpx;
		position: absolute;
		top: 310rpx;
		left: 35rpx;
	}

	.qbimg {
		width: 32rpx;
		height: 32rpx;
		position: absolute;
		top: 26rpx;
		left: 30rpx;
	}

	.qbfont {
		font-size: 28rpx;
		color: #333333;
		position: absolute;
		top: 23rpx;
		left: 77rpx;
	}

	.dashed {
		color: #D421EE;
		position: absolute;
		top: 16rpx;
		left: 200rpx;
	}

	.txian {
		width: 80rpx;
		height: 36rpx;
		background: linear-gradient(45deg, rgba(212, 32, 238, 1) 0%, rgba(115, 34, 216, 1) 100%);
		border-radius: 18rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		display: flex;
		justify-content: center;
		align-items: center;
		position: absolute;
		top: 24rpx;
		right: 30rpx;
	}

	.vouchersBox {
		width: 680rpx;
		height: 120rpx;
		margin-top: 98rpx;
		display: flex;
		align-items: center;
	}

	.record {
		width: 170rpx;
		height: 100rpx;
		display: flex;
		justify-content: center;
		position: relative;
		overflow: hidden;
	}

	.dasheda {
		font-size: 34rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(206, 33, 237, 1);
	}

	.gongxian {
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(116, 34, 216, 1);
		position: absolute;
		top: 50rpx;
	}

	.peopleInfo {
		width: 600rpx;
		height: 250rpx;
		position: relative;
		top: 100rpx;
		left: 35rpx;
	}

	.photoa {
		width: 121rpx;
		height: 121rpx;
		border-radius: 50%;
		position: absolute;
		top: 35rpx;
	}

	.viplogo {
		width: 40rpx;
		height: 34rpx;
		position: absolute;
		top: 128rpx;
		left: 80rpx;
	}

	.nameBox {
		width: 500rpx;
		height: 40rpx;
		position: absolute;
		left: 155rpx;
		top: 30rpx;
		display: flex;
	}

	.name {
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(255, 255, 255, 1);
	}

	.invitationCode {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		position: absolute;
		top: 85rpx;
		left: 155rpx;
	}

	.address {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		position: absolute;
		top: 128rpx;
		left: 155rpx;
	}

	.vipBox {
		padding: 20rpx 15rpx;
		background: rgba(115, 34, 216, 1);
		border-radius: 10rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-left: 10rpx;
		box-sizing: border-box;
		margin-top: 6rpx;
	}

	.vip {
		width: 30rpx;
		height: 26rpx;
	}

	.huangguan {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		margin-left: 10rpx;
	}

	.advertisement {
		width: 680rpx;
		height: 120rpx;
		margin: 148rpx 0rpx 0rpx 35rpx;
	}

	.boxtwo {
		width: 750rpx;
		height: 130rpx;
		margin-top: 10rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.invitationfriend {
		width: 330rpx;
		height: 120rpx;
		box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(117, 34, 217, 0.1);
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.share {
		width: 330rpx;
		height: 120rpx;
		box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(117, 34, 217, 0.1);
		display: flex;
		justify-content: center;
		align-items: center;
		margin-left: 15rpx;
	}

	.invation_icon {
		width: 46rpx;
		height: 42rpx;
	}

	.invation_font {
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(51, 51, 51, 1);
		margin-left: 20rpx;
	}

	.orderBox {
		width: 750rpx;
		height: 320rpx;
		position: relative;
		top: 130rpx;
	}

	.frame {
		display: block;
		width: 10rpx;
		height: 30rpx;
		background: rgba(115, 34, 216, 1);
		border-radius: 5rpx;
		position: absolute;
		left: 35rpx;
		top: 30rpx;
	}

	.myOrder {
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(51, 51, 51, 1);
		position: absolute;
		left: 56rpx;
		top: 22rpx;
	}

	.allorder {
		width: 680rpx;
		height: 228rpx;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(117, 34, 217, 0.1);
		border-radius: 20rpx;
		position: relative;
		top: 90rpx;
		left: 35rpx;
	}

	.online {
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(51, 51, 51, 1);
		position: absolute;
		top: 28rpx;
		left: 21rpx;
	}

	.switch {
		width: 22rpx;
		height: 20rpx;
		position: absolute;
		top: 38rpx;
		left: 160rpx;
	}

	.unline {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(142, 142, 142, 1);
		position: absolute;
		top: 34rpx;
		left: 199rpx;
	}

	.viewAll {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(115, 34, 216, 1);
		position: absolute;
		right: 47rpx;
		top: 29rpx;
	}

	.left_icon {
		font-size: 30rpx;
		color: rgba(115, 34, 216, 1);
		font-weight: bold;
		position: absolute;
		right: 20rpx;
		top: 24rpx;
	}

	.statuebox {
		width: 680rpx;
		height: 160rpx;
		position: relative;
		top: 65rpx;
		display: flex;
		justify-content: space-between;
		display: flex;
	}

	.paystatue {
		width: 132rpx;
		height: 160rpx;
		display: flex;
		justify-content: center;
	}

	.statueimg:nth-child(1) {
		width: 50rpx;
		height: 50rpx;
		margin-top: 30rpx;
	}

	.statueimg:nth-child(2) {
		width: 52rpx;
		height: 46rpx;
	}

	.statueimg:nth-child(3) {
		width: 46rpx;
		height: 46rpx;
	}

	.statueimg:nth-child(4) {
		width: 54rpx;
		height: 48rpx;
	}

	.statueimg:nth-child(5) {
		width: 44rpx;
		height: 54rpx;
	}

	.statueFont {
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(51, 51, 51, 1);
		position: absolute;
		top: 105rpx;
	}

	.fotter {
		width: 750rpx;
		height: 500rpx;
		margin: 30rpx 0rpx 50rpx 0rpx;
		position: relative;
		top: 120rpx;
		margin-bottom: 110rpx;
	}

	.bksolid {
		display: block;
		width: 10rpx;
		height: 30rpx;
		background: rgba(115, 34, 216, 1);
		border-radius: 5rpx;
		position: absolute;
		left: 35rpx;
		top: 8rpx;
	}

	.administration {
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(46, 46, 46, 1);
		position: absolute;
		left: 56rpx;
		top: 0rpx;
	}

	.infoBox {
		width: 680rpx;
		position: relative;
		top: 85rpx;
		left: 35rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		align-content: space-between;
	}

	.adminSon {
		width: 202rpx;
		height: 112rpx;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0rpx 0rpx 18rpx 2rpx rgba(115, 34, 216, 0.1);
		border-radius: 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-bottom: 20rpx;
	}

	.infoImg {
		width: 32rpx;
		height: 32rpx;
	}

	.infoFont {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(51, 51, 51, 1);
		margin-left: 15rpx;
	}
</style>
